import React, { Component } from 'react';
import { Modal } from 'antd';
import { connect } from 'dva';

@connect(({ component }) => ({
  isRightDrawOpen: component.isRightDrawOpen,
}))
export default class AdModal extends Component {
  constructor(props) {
    super(props);
  }
  componentWillReceiveProps(nextProps) {
    const { visible, dispatch, isRightDrawOpen } = nextProps;
    let isRightDrawOtherOpen = false;
    if (this.props.visible !== visible) {
      if (visible) {
        isRightDrawOtherOpen = true;
      }
      if (!isRightDrawOpen) return;
      dispatch({
        type: 'component/setRightDrawValue',
        payload: {
          isRightDrawOtherOpen,
        },
      });
    }
  }
  componentDidMount(){
    // const {padding,title,}=this.props
    // console.log('padding',padding)
    // setTimeout(()=>{
    //   if(padding){
    //     let ItemEle = document.querySelector('.ant-modal-body')
    //     console.log('ItemEle',ItemEle)
    //     // ItemEle.style.paddingLeft=`${padding}`||`${padding}px`
    //   }
    // },1000)
  }
  render() {
    const { children, ...rest } = this.props;
    return (
      <Modal width={620} destroyOnClose={true} style={{ top: 20 }} {...rest}>
        {children}
      </Modal>
    );
  }
}
